import type { Map, MapMouseEvent, MapWheelEvent } from 'mapbox-gl'
import type { Interaction } from './types'
import { setInteractionNormal } from './core'
import { unSelectMapItem } from '@/map-item'
import { overlay } from '@/map'

export abstract class BaseInteraction implements Interaction {
  abstract type: string
  protected map: Map | null = null

  public attach(map: Map): void {
    this.map = map
    unSelectMapItem()
  }

  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  public detach(map: Map): void {
    this.map = null
    overlay.clear()
  }

  public finish(): void {
    setInteractionNormal()
  }

  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  public onMouseEnter(evt: MapMouseEvent): void {}
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  public onMouseLeave(evt: MapMouseEvent): void {}
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  public onMouseMove(evt: MapMouseEvent): void {}
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  public onMouseUp(evt: MapMouseEvent): void {}
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  public onMouseDown(evt: MapMouseEvent): void {}
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  public onWheel(evt: MapWheelEvent): void {}
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  public onKeyDown(evt: KeyboardEvent): void {}
}
